package com.linkage.jz.bankruptcy.bean.Vote;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


/**
 * @author AFAP
 * 表决规则
 */
public class ProVoteRule implements Serializable {
    /**
     * id : 14or1paphmjhepghhfautfgnda
     * type : 2
     * name : 重整分组
     * explains : 请您仔细查阅公告的表决事项详情，您可在通知的时间内提前确定是否参会，并在表决开始后行使表决权，或于表决开始后直接参会表决。本表决事项适用《中华人民共和国企业破产法》第八十四条第二款，“出席会议的同一表决组的债权人过半数同意重整计划草案，并且其所代表的债权额占该组债权总额的三分之二以上的，即为该组通过重整计划草案。”第八十六条第一款，“第八十六条 各表决组均通过重整计划草案时，重整计划即为通过。”
     * moneyPercent : 66.66
     * personnelPercent : 50.0
     * grouped : 1
     */

    private String id;
    private int type;
    private String name;
    private String explains;
    private double moneyPercent;
    private double personnelPercent;
    private int grouped;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getExplains() {
        return explains;
    }

    public void setExplains(String explains) {
        this.explains = explains;
    }

    public double getMoneyPercent() {
        return moneyPercent;
    }

    public void setMoneyPercent(double moneyPercent) {
        this.moneyPercent = moneyPercent;
    }

    public double getPersonnelPercent() {
        return personnelPercent;
    }

    public void setPersonnelPercent(double personnelPercent) {
        this.personnelPercent = personnelPercent;
    }

    public int getGrouped() {
        return grouped;
    }

    public void setGrouped(int grouped) {
        this.grouped = grouped;
    }

    public static List<ProVoteRule> parse(JsonArray arr) {
        List<ProVoteRule> list = new ArrayList<>();
        for (int i = 0; i < arr.size(); i++) {
            list.add(parse(arr.get(i).getAsJsonObject()));
        }
        return list;
    }

    public static ProVoteRule parse(JsonObject obj) {
        ProVoteRule bean = new Gson().fromJson(obj, ProVoteRule.class);
        return bean;
    }
}
